<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org/">
<head>
    <meta charset="UTF-8">
    <title>书籍列表</title>
    <link rel="stylesheet" type="text/css" th:href="@{/manager/easyui/themes/default/easyui.css}">
    <link rel="stylesheet" type="text/css" th:href="@{/manager/easyui/themes/icon.css}">
    <script type="text/javascript" th:src="@{/manager/easyui/jquery.min.js}"></script>
    <script type="text/javascript" th:src="@{/manager/easyui/jquery.easyui.min.js}"></script>
    <script type="text/javascript">
        $(function () {
            $("ISBNKey").val("");
            $("booknameKey").val("");
            $('#booklist').datagrid({
                title: '书籍列表',
                iconCls: 'icon-save',
                url: "/manager/book/findBooksBySupplier",
                columns: [
                    [
                        {
                            field: 'bookname', title: '名称', width: 100, align: 'center',
                            formatter: function (value, row, index) {
                                if (row.book == null) {
                                    return "--";
                                }
                                return row.book.bookname;
                            }
                        },
                        {
                            field: 'author', title: '作者', width: 200, align: 'center',
                            formatter: function (value, row, index) {
                                if (row.book == null) {
                                    return "--";
                                }
                                return row.book.author;
                            }
                        },
                        {
                            field: 'price', title: '单价', width: 80, align: 'center',
                            formatter: function (value, row, index) {
                                if (row.book == null) {
                                    return "--";
                                }
                                return row.book.price;
                            }
                        },
                        {
                            field: 'iSBN', title: 'ISBN', width: 200, align: 'center',
                            formatter: function (value, row, index) {
                                if (row.book == null) {
                                    return "--";
                                }
                                return row.book.iSBN;
                            }
                        },
                        {
                            field: 'press', title: '出版社', width: 200, align: 'center',
                            formatter: function (value, row, index) {
                                if (row.book == null) {
                                    return "--";
                                }
                                return row.book.press.name;
                            }
                        },
                        {field: 'number', title: '进货数', width: 200, align: 'center'},
                        {field: 'sellnum', title: '销售数', width: 200, align: 'center'},
                        {field: 'totalMoney', title: '总金额', width: 200, align: 'center'}
                    ]
                ],
                pagination: true,//表示在datagrid设置分页
                pageSize: 5,
                singleSelect: true,
                pageList: [5, 10, 20]
            });

            //初始化查询栏
            $("#submit_search").linkbutton({iconCls: 'icon-search', plain: true})
                .click(function () {
                    $('#booklist').datagrid({
                        queryParams:
                            {
                                "booknameKey": $("#booknameKey").val(),
                                "ISBNKey": $("#ISBNKey").val(),
                            }
                    });   //点击搜索
                });


        });
    </script>
</head>
<body>
<form name="searchform" method="post" action="" id="searchform">
    <td width="70" height="30"><strong>书籍查询：</strong></td>
    <td height="30">
        <input type="text" name="booknameKey" id="booknameKey" size=20 placeholder="书籍名称"/>
        <input type="text" name="ISBNKey" id="ISBNKey" size=20 placeholder="ISBN"/>
    </td>
    <td>
        <a id="submit_search">搜索</a>
    </td>
</form>
<table id="booklist"></table>
</body>
</html>